<?php

/**
 * The JpgImage class, Image that will be created in the JPG format.
 *
 * @version $Revision v1.00$
 * @author Bryan Spirit & Mark Kazemier
 */
class JpgImage extends Image
{
    public function create($iQuality = 100)
    {
        ob_start();
        
        if(!imagejpeg($this->getResource(), null, $iQuality))
        {
            ob_end_clean();
            throw new ImageCreateException('The Image could not be created');
        }
        
        $sImage = ob_get_contents();
        ob_end_clean();
        
        return $sImage;
    }
    
    public function header()
    {
        header('Content-type: image/jpeg');
    }
}
